<section id="header">
	<div class="container">
		<div class="rows">
			<div class="col-md-9 col-sm-12">
				<div class="box-title-page">
					<h4>Products</h4>
				</div><br />
				<div class="row">
					<?php if(isset($sub_items) && !empty($sub_items)) {?>
					<div class="col-md-12 col-sm-12">
						<ul id="tabs">
				            <?php $i = 1; if(isset($sub_items) && !empty($sub_items)): foreach ($sub_items as $sub): ?>
							<?php 
								$class = '';
								if($i == 1) $class= 'class="active"';
							?>
								<li <?php echo $class;?>><?php echo $sub->scp_name;?></li>
							<?php $i++;?>
							<?php endforeach; endif; ?>
				        </ul>
				        <ul id="tab">
				        	<?php 
				        		if(isset($items))
				        		{
				        			$j = 1;
				        			foreach ($items as $key => $value) {
				        				if($j == 1) $class = 'class="active"';
				        				else $class= '';
				        				echo "<li $class>";
				        				foreach ($value as $as => $valueItems) {
				        					// echo $valueItems->p_filename;
				        					?> 
				        					<div class="col-md-4 col-sm-12" style='margin-bottom:10px !important;'>
												<div class="box-product">
													<div class='image-product'>
														<?php if(empty($valueItems->p_filename)) { ?>
														<img class="img-responsive" width='138' height='89' src="<?php echo img_theme('logo.png'); ?>" alt="Logo">
														<?php } else { ?>
														<img class="img-responsive" src="<?php echo site_url('products/appimage/products/thumbnail/'.$valueItems->p_filename); ?>" alt="<?php echo $valueItems->p_fileorig; ?>">
														<?php } ?>	
													</div>			
													<div class="caption">
														<a href="<?php echo site_url('products/detail/'.slugify($valueItems->p_name).'/'.$valueItems->p_id); ?>"><h2 style='margin-bottom:1px !important;color:#b9b9b9;'><?php echo $valueItems->p_name; ?></h2></a>
													</div>
												</div>
											</div>
				        					<?php
				        				}
				        				echo "</li>";
				        				$j++;
				        			}
				        		}
				        	?>
				        </ul>
			        </div>
				    <?php } else { ?>
					    <?php if(isset($items_non) && !empty($items_non)): foreach ($items_non as $item_non): ?>
						<div class="col-md-4 col-sm-12" style='margin-bottom:10px !important;'>
							<div class="box-product">
								<div class='image-product'>
									<?php if(empty($item_non->p_filename)) { ?>
									<img class="img-responsive" width='138' height='89' src="<?php echo img_theme('logo.png'); ?>" alt="Logo">
									<?php } else { ?>
									<img class="img-responsive" src="<?php echo site_url('products/appimage/products/thumbnail/'.$item_non->p_filename); ?>" alt="<?php echo $item_non->p_fileorig; ?>">
									<?php } ?>	
								</div>			
								<!-- End -->
								<div class="caption">
									<a href="<?php echo site_url('products/detail/'.slugify($item_non->p_name).'/'.$item_non->p_id); ?>"><h2 style='margin-bottom:1px !important;color:#b9b9b9;'><?php echo $item_non->p_name; ?></h2></a>
									<!-- <h4 style='color:#e60000;margin-top:0px !important'><?php echo date("d F, Y", strtotime($item->p_created_date)); ?></h4> -->
								</div>
							</div>
						</div>
						<?php endforeach; endif; ?>
				    <?php } ?>
				</div>
			</div>
			<div class="col-md-3 col-sm-12">
				<div class="list-group">
				        <a href="#" class="list-group-item active">
				            <i class="fa fa-gift"></i> Categories Product
				        </a>
				        <?php if(isset($categories)): foreach ($categories as $cat): ?>
							<a href="<?php echo site_url('products/categories/'.$cat->cp_id.'/'.$cat->cp_name); ?>" class="list-group-item">
								<i class="fa fa-gift"></i> <?php echo $cat->cp_name; ?>
							</a>	
						<?php endforeach; endif; ?>
				</div>
				<div class="bs-example">
				    <div class="list-group">
				        <a href="#" class="list-group-item active">
				            <span class="glyphicon glyphicon-file"></span> Recent Article
				        </a>
				        <?php if(isset($recent_articles)): foreach ($recent_articles as $articles): ?>
							<a href="<?php echo site_url('articles/detail/'.slugify($articles->a_title).'/'.$articles->a_id); ?>" class="list-group-item">
								<i class="fa fa-gift"></i> <?php echo $articles->a_title; ?>
							</a>	
						<?php endforeach; endif; ?>
				    </div>
				</div>
				<div class="bs-example">
				    <div class="list-group">
				        <a href="#" class="list-group-item active">
				            <span class="glyphicon glyphicon-file"></span> Recent Recipes
				        </a>
				        <?php if(isset($recent_recipes)): foreach ($recent_recipes as $recipes): ?>
							<a href="<?php echo site_url('recipes/detail/'.slugify($recipes->r_name).'/'.$recipes->r_id); ?>" class="list-group-item">
								<i class="fa fa-gift"></i> <?php echo $recipes->r_name; ?>
							</a>	
						<?php endforeach; endif; ?>
				    </div>
				</div>
				<div style='margin-top:10px;'>
					<?php
						if(isset($widget_home)): foreach ($widget_home as $widget): 
							if ($widget->widget_place == 1)	echo $widget->widget_source;
						endforeach; endif; 
					?>
				</div>
				<!-- <div class="box-title">
					<h4>FIND RECIPES</h4>
				</div>
				<div class="box-input">
					<input class="find-recipes" name="find_serch" placeholder=" Recipes">
				</div>
				<div style='margin-top:10px;'>
					<?php if(isset($widget_home)): foreach ($widget_home as $widget): 
							if ($widget->widget_place == 1)	echo $widget->widget_source;
					endforeach; endif; ?>
				</div> -->
			</div>
		</div>
	</div>
</section>